package com.smartwasser.yunhtgl.apphtgl.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

import static com.smartwasser.yunhtgl.apphtgl.base.BaseConstant.GESTURE_PASSWORD;
import static com.smartwasser.yunhtgl.apphtgl.base.BaseConstant.IS_FIRST;
import static com.smartwasser.yunhtgl.apphtgl.base.BaseConstant.SP_FILE_NAME;

public class AppConfigSP {
    private SharedPreferences mAppConfigSP;

    public AppConfigSP(Context context) {
        mAppConfigSP = context.getSharedPreferences(SP_FILE_NAME, Context.MODE_PRIVATE);
    }

    public void setGesturePassword(String password) {
        Editor editor = mAppConfigSP.edit();
        editor.putString(GESTURE_PASSWORD, password);
        editor.commit();
    }

    public String getGesturePassword() {
        return mAppConfigSP.getString(GESTURE_PASSWORD, "");
    }

    public void setFirst(Boolean is) {
        Editor editor = mAppConfigSP.edit();
        editor.putBoolean(IS_FIRST, is);
        editor.commit();
    }

    public boolean getFirst() {
        return mAppConfigSP.getBoolean(IS_FIRST, true);
    }
}